<!-- 公共文件 start -->
@extends('admin.public.base')
<!-- 公共文件 end -->
<style>
    table th {
        min-width: 10px !important;
    }
    .layui-card-header {
        padding-top: 10px !important;
    }
</style>
@section('content')
    <div class="x-nav">
    <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">财务报表</a>
        <a><cite>库存报表</cite></a>
    </span>
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
           onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
        </a>
    </div>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5">
                            <div class="layui-inline layui-show-xs-block">
                                <input type="radio" name="type" value="1" title="日报" checked>
                                <input type="radio" name="type" value="2" title="月报" @if(request()->input('type') == 2) checked @endif>
                                <input type="radio" name="type" value="3" title="年报" @if(request()->input('type') == 3) checked @endif>
                            </div>
                            <div class="layui-inline layui-show-xs-block">
                                <input class="layui-input" autocomplete="off" placeholder="开始时间" name="start" id="start" value="{{request()->input('start')}}">
                            </div>
                            <div class="layui-inline layui-show-xs-block">
                                <input class="layui-input" autocomplete="off" placeholder="截止时间" name="end" id="end" value="{{request()->input('end')}}">
                            </div>
                            <div class="layui-inline layui-show-xs-block">
                                <button id="search" class="layui-btn" lay-submit="" lay-filter="sreach">
                                    <i class="layui-icon">&#xe615;搜索</i>
                                </button>
                                <input type="hidden" id="export_excel" name="export_excel" value="0">
                                <button id="export_excel_btn" class="layui-btn" lay-submit="" lay-filter="sreach"><i
                                        class="layui-icon">&#xe65b;</i>导出Excel
                                </button>
                            </div>
                        </form>
                    </div>
                    <div class="layui-card-body ">
                        <table class="layui-table layui-form" style="width: 100%">
                            <thead>
                            <tr>
                                <th>商品编号</th>
                                <th>商品名称</th>
                                <th>零售价格/元</th>
                                <th>期初库存/瓶</th>
                                <th>入库/瓶</th>
                                <th>销售/瓶</th>
                                <th>销售额/元</th>
                                <th>库存/瓶</th>
                            </thead>
                            <tbody>
                            @foreach($data as $item)
                                <tr>
                                    <td>
                                        {{$item['goods_sn']}}
                                    </td>
                                    <td>
                                        {{$item['goods_name']}}
                                    </td>
                                    <td>
                                        {{$item['goods_price']}}
                                    </td>
                                    <td>
                                        {{$item['qckc']}}
                                    </td>
                                    <td>
                                        {{$item['rk']}}
                                    </td>
                                    <td>
                                        {{$item['xs']}}
                                    </td>
                                    <td>
                                        {{$item['xse']}}
                                    </td>
                                    <td>
                                        {{$item['kc']}}
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            {{ $data->links('admin/public/page') }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        layui.use(['laydate', 'form'], function(){
            form = layui.form, laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start', //指定元素
                type: 'datetime'
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end', //指定元素
                type: 'datetime'
            });
        });

        $("#export_excel_btn").on('click', function () {
            layer.load(2, {
                time: 10000
            });
            $("#export_excel").val(1)
        });
        $("#search").on('click', function () {
            layer.load(2, {
                time: 10000
            });
            $("#export_excel").val(0);
        });
    </script>
@endsection
